import { Directive, HostListener, ElementRef } from '@angular/core';
import { NavController } from 'ionic-angular';
import { DeviceDetailPage } from '../pages/device/device-detail/device-detail'
/**
 * Generated class for the DynamicGisBtnDirective directive.
 *
 * See https://angular.io/api/core/Directive for more info on Angular
 * Directives.
 */
@Directive({
  selector: '[dynamic-gis-btn]' // Attribute selector
})
export class DynamicGisBtnDirective {

  
  constructor(public navCtrl: NavController,
              public ref: ElementRef) {
    //console.log('Hello DynamicGisBtnDirective Directive');
  }
  @HostListener('mouseenter') onMouseEnter() {
    // alert(1);
    // this.navCtrl.push(DeviceDetailPage)
  }
  @HostListener('mousedown') onMouseDown() {
    // alert(2);
    var _id = this.ref.nativeElement.getAttribute('id');
    this.navCtrl.push(DeviceDetailPage, {id: _id})
  }

}
